﻿using NodeEditor;

namespace ETHotfix
{
    [NodeEvent(typeof(InputSpriteNode))]
    public class InputSpriteNodeHandle : NodeHandle<InputSpriteNode>
    {
        const string indexStr = "index";
        protected override void OnHandle(RuntimeTree runtimeTree, RuntimeNode runtimeNode, InputSpriteNode data, Unit unit)
        {
            data.index = runtimeNode.GetInputValue(indexStr, data.index);
            if (data.index >= data.sprites.Length)
                return;

            data.result = data.sprites[data.index];
        }
    }
}